package com.loan.common.enums;

import com.loan.common.utils.StringUtils;

public enum UserRedEnvelopeDetailTypeEnum {

    /**
     * 钻石收支类型
     */
    SEND_ENVELOPE_SCORE("SEND_ENVELOPE_SCORE", "发送宝箱支出钻石"),
    OPEN_ENVELOPE_SCORE("OPEN_ENVELOPE_SCORE", "打开宝箱获得钻石"),
    SEND_ENVELOPE_AGENT_BONUS("SEND_ENVELOPE_AGENT_BONUS", "发送宝箱扣除代理钥匙"),
    SEND_ENVELOPE_AGENT_SCORE("SEND_ENVELOPE_AGENT_SCORE", "发送宝箱代理钻石提成"),
    OPEN_ENVELOPE_AGENT_SCORE("OPEN_ENVELOPE_AGENT_SCORE", "打开宝箱代理钻石提成"),
    SEND_ENVELOPE_SUFFIX_SCORE("SEND_ENVELOPE_SUFFIX_SCORE", "发送宝箱中奖尾数获得钻石"),
    OPEN_ENVELOPE_SUFFIX_SCORE("OPEN_ENVELOPE_SUFFIX_SCORE", "打开宝箱中奖尾数支出钻石"),

    EXPIRE_ENVELOPE_SCORE("EXPIRE_ENVELOPE_SCORE", "宝箱过期钻石返还"),
    EXCHANGE_BONUS("EXCHANGE_BONUS", "钥匙兑换钻石"),
    CHARGE_SCORE("CHARGE_SCORE", "为指定用户充值钻石"),
    CHARGE_BONUS("CHARGE_BONUS", "为指定用户充值钥匙"),
    WITHDRAW_SCORE("WITHDRAW_SCORE", "为指定用户提现钻石"),
    ;

    String code;
    String desc;

    UserRedEnvelopeDetailTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public UserRedEnvelopeDetailTypeEnum getUserTypeEnum(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (UserRedEnvelopeDetailTypeEnum typeEnum : UserRedEnvelopeDetailTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }
}
